import 'package:flutter/material.dart';
import 'package:online_study/course/comment_item.dart';
import 'package:online_study/theme/colors.dart';
import 'package:online_study/theme/size.dart';


//课程评论
class CourseCommentsPage extends StatefulWidget {
  @override
  _CourseCommentsPageState createState() => _CourseCommentsPageState();
}

class _CourseCommentsPageState extends State<CourseCommentsPage>
    with AutomaticKeepAliveClientMixin {
  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        Container(
          alignment: Alignment.centerLeft,
          padding: EdgeInsets.symmetric(horizontal: ThemeSize.width19),
          width: double.infinity,
          height: ThemeSize.height42,
          color: ThemeColor.colorWhite,
          child: Text("学习评论",
              style: TextStyle(
                  color: ThemeColor.color333333,
                  fontSize: ThemeSize.sp13,
                  fontWeight: FontWeight.bold)),
        ),
        Divider(height: ThemeSize.width1),
        Expanded(
            child: ListView.separated(
          itemBuilder: (BuildContext context, int index) {
            return CommentItemPage();
          },
          separatorBuilder: (BuildContext context, int index) {
            return Divider(height: ThemeSize.width1);
          },
          itemCount: 8,
          shrinkWrap: true,
        )),
        Divider(height: ThemeSize.width1),
        Container(
          padding: EdgeInsets.symmetric(horizontal: ThemeSize.width19),
          height: ThemeSize.height42,
          color: ThemeColor.colorWhite,
          child: Row(
            children: [
              Expanded(
                child: Container(
                  padding: EdgeInsets.only(left: ThemeSize.width19),
                  height: ThemeSize.height30,
                  decoration: BoxDecoration(
                      borderRadius: BorderRadius.circular(ThemeSize.width15),
                      color: ThemeColor.colorF2F2F2),
                  child: TextField(
                    decoration: InputDecoration(
                        border: InputBorder.none,
                        hintText: "我也来说一下学习感受",
                        hintStyle: TextStyle(
                            color: ThemeColor.color808080,
                            fontSize: ThemeSize.sp12)),
                    style: TextStyle(
                        color: ThemeColor.color333333,
                        fontSize: ThemeSize.sp13),
                  ),
                ),
              ),
              Container(
                padding: EdgeInsets.symmetric(horizontal: ThemeSize.width8),
                width: ThemeSize.width24,
                child: Icon(Icons.check_circle_outline),
              ),
              Text("匿名",
                  style: TextStyle(
                      color: ThemeColor.color808080, fontSize: ThemeSize.sp16)),
              TextButton(
                  style: ButtonStyle(
                      backgroundColor:
                          MaterialStateProperty.all<Color>(Colors.grey)),
                  onPressed: () {},
                  child: Text("发送",
                      style: TextStyle(
                          color: ThemeColor.colorWhite,
                          fontSize: ThemeSize.sp16)))
            ],
          ),
        )
      ],
    );
  }

  @override
  bool get wantKeepAlive => true;
}
